<IP>:9292This section is meant to help you write the basic skeleton for a UDP client and server.
A UDP echo server is running at <IP>:5000. You may connect to it using nc -u <IP> 5000 to test your connectivity. It will echo back any message you send to it.
Write a basic UDP socket client to connect to this server, send a message, read a response and print it to the screen.
Write a similar echo server yourself. Test it using the client you wrote.
Write a UDP client that will send a heartbeat message to the server, and wait for a response from it, then sleep 1 second before the next heatbeat and repeat the process. Print the response to stdout. The heartbeat message sent has to be an integer picked up from stdin or the command line arguments (hereinafter called the “tag”). The response can be anything for now, though this will change in later parts.
# the message sent on each heartbeat will be "33"
$ ./client 8
Write a server that will accept commands from standard input and enqueue them. The input format should be <int tag> <command>. For example: 8 ls /home.
The tag can be any integer from 0 to 16. Then when a client sends a
heartbeat with a tag, reply with the earliest command with the same tag
as a string. If no commands are in queue with that tag. The client is
then expected to respond with the number 0, that the server reads and prints to the console.
Note:
Clients may send heartbeats before you have inserted a command from the
server terminal - in that case the server will send an empty message
back and the client can skip doing anything and return 0
Note2: The server sends a non-empty message only once some command has
been entered from the stdin, so it has to support taking in user input
from the terminal even after starting to accept/handle the client.
Note3: Commands queued on the server with a tag that no client has yet sent, will remain in the server queue for that tag
Modify
your previous echo client. It must still send a heartbeat like before,
read the response from the server, and if it contains a command, execute
it and send the exit code back to the server (instead of the fixed 0 that you were sending in 2.2). The server must print the exit code to its stdout
Extend the previous client and server. Make the client send not just the exit code, but also the contents of stdout and stderr to the server. The server must print this received stdout data to stdout and stderr data to stderr. It must print the exit code to stderr too.
Clients must be given tasks by the server in a first-come-first-served fashion.